package com.read.operationsapi.controller;

import com.mc.read.dao.models.Bookinformation;
import com.mc.read.vo.respose.CrawlerRespose;
import com.read.operationsapi.service.CrawlerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author liuhao
 * @date 2019/6/17 14:57
 * 爬虫controller
 */
@Controller
@RequestMapping(value = "/crawler/")
public class CrawlerController {
    @Autowired
    CrawlerService crawlerService;

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 查询书籍是否存在 selectBookIsExist
     **/
    @ResponseBody
    @RequestMapping(value = "selectBookIsExist")
    public CrawlerRespose selectBookIsExist(Bookinformation bookinformation) {
        CrawlerRespose baseRespose = crawlerService.selectBookIsExist(bookinformation);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:15:24 2019/5/31
     * 爬虫添加书籍 addBookForCrawler
     **/
    @ResponseBody
    @RequestMapping(value = "addBookForCrawler")
    public CrawlerRespose addBookForCrawler(Bookinformation bookinformation) {
        CrawlerRespose baseRespose = crawlerService.addBookForCrawler(bookinformation);
        return baseRespose;
    }


}
